package com.itheima.mapper;

import com.itheima.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: 放学后海堤日记
 * @Date: 2023/4/7 23:26
 * @Desc:
 */
@Mapper
public interface DeptMapper {
    //添加部门
    @Insert("insert into dept (name, create_time, update_time) values (#{name}, now(), now())")
    void addDept(String name);

    //删除部门信息
    @Delete("delete from dept where id = #{id}")
    void deleteDept(Integer id);

    //修改部门信息
    @Update("update dept set name = #{name}, update_time = now() where id = #{id}")
    void updateDept(Integer id, String name);

    //查询部门信息
    List<Dept> deptList();

    //根据id查询
    List<Dept> findDeptById(Integer id);

    //根据部门名查询部门信息
    List<Dept> findDeptByName(String name);
}
